<template>
  <div class="home-container">
    <!-- 已删除首页标题 -->
    <section class="repo-section">
      <a href="https://gitee.com/tian158/todolist-homework" 
         target="_blank" 
         rel="noopener noreferrer"
         class="repo-link">
        Gitee仓库地址
      </a>
    </section>
    <div class="dynamic-background"></div>
  </div>
</template>

<style scoped>
.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh; /* 全屏居中 */
}

.repo-section {
  position: relative;
  z-index: 1;
  padding: 2rem;
  margin: auto; /* 自动居中 */
  width: 80%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.dynamic-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    #f3ecf8,
    #e8dff5,
    #d8e4ff,
    #d0f4f4
  );
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
  z-index: -1; /* 调整为负层级 */
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* 保持原有内容在背景之上 */
h1 {
  position: relative;
  z-index: 1;
  color: #2c3e50;
  padding: 2rem 0;
  text-align: center;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px); /* 留出导航栏空间 */
}

/* 新增仓库区块样式 */
.repo-section {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  margin: 20px;
  width: 80%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-30%); /* 上移避免标题遮挡 */
}

.repo-link {
  display: inline-block;
  padding: 12px 24px;
  background: #42b883;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.repo-link:hover {
  background: #3aa876;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 184, 131, 0.3);
}
</style>

<script setup lang="ts">
import { useAuthStore } from '../stores/auth';
import { useRouter } from 'vue-router';

const authStore = useAuthStore();
const router = useRouter();

const handleLogout = () => {
  authStore.logout();
  router.push('/login');
};
// 这里可以添加首页的逻辑
</script>
